<script setup>
import DeviceItem from './components/deviceItem.vue'

// 获取屏幕边界到安全区域距离
const { safeAreaInsets } = uni.getSystemInfoSync()

// 添加设备
const addDevice = () => {
  uni.navigateTo({ url: '/pagesMember/addDevice/addDevice' })
}
</script>

<template>
  <scroll-view scroll-y enable-back-to-to>
    <view class="device">
      <DeviceItem />

      <view class="addDevice" :style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }">
        <button class="button" hover-class="button-hover" @tap="addDevice">添加设备</button>
      </view>
    </view>
  </scroll-view>
</template>

<style lang="scss">
.device {
  height: 100vh;
  position: relative;
  background-color: #f0f1f5;
  .addDevice {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 200rpx;
    background-color: #fff;
    position: absolute;
    bottom: 0;
    .button {
      width: 100%;
      margin: 0 50rpx;
      color: #fff;
      border-radius: 50rpx;
      background-color: #08afa3;
    }
  }
}
</style>
